package com.xy.servicemanage.model;

public class Tdatabase {
	/** @pdOid 0aa37fb9-4456-438d-b9e0-92b0568a5825 */
	private String dataSourceID;
	/** @pdOid e309cb28-71d2-4d87-9dfd-c993a2d688bd */
	private String jdbcDriver;
	/** @pdOid fe0ed0d7-9417-4f6c-9be1-c4c9a9b2bb2f */
	private String jdbcUrl;
	/** @pdOid 65462a6b-de35-4d83-9578-087d983a6343 */
	private String jdbcUser;
	/** @pdOid f497c8db-48c7-4d1a-9be6-ba9670cf9b50 */
	private String JdbcPassword;
	/** @pdOid 86d2dee6-1afe-4fd7-9c8d-d194cf991611 */
	private String bz;
	private String dbtype;
	private String charset;
	private int poolsize;

	public String getCharset() {
		return charset;
	}

	public String getDbtype() {
		return dbtype;
	}

	public Tdatabase(String dataSourceID, String jdbcDriver, String jdbcUrl,
			String jdbcUser, String jdbcPassword, String bz) {
		super();
		this.dataSourceID = dataSourceID;
		this.jdbcDriver = jdbcDriver;
		this.jdbcUrl = jdbcUrl;
		this.jdbcUser = jdbcUser;
		this.JdbcPassword = jdbcPassword;
		this.bz = bz;
		if (jdbcDriver.equals("com.mysql.jdbc.Driver")) {
			dbtype = "mysql";
		} else if (jdbcDriver.equals("oracle.jdbc.driver.OracleDriver")) {
			dbtype = "oracle";
		}
		//charset=utf-8,poolsize=10
		if (bz != null) {
			int cind=bz.indexOf("charset");
			if (cind != -1) {
				String tmp= bz.substring(cind + 8).trim();
				cind=tmp.indexOf(",");
				if(cind!=-1){
				 tmp=tmp.substring(0,cind);
				}
				this.charset=tmp;
			}
			cind=bz.indexOf("poolsize");
			if (cind != -1) {
				String tmp= bz.substring(cind + 9).trim();
				cind=tmp.indexOf(",");
				if(cind!=-1){
				 tmp=tmp.substring(0,cind);
				}
				this.poolsize=Integer.valueOf(tmp);
			}
			
		}
	}

	public int getPoolsize() {
		return poolsize;
	}

	public String getDataSourceID() {
		return dataSourceID;
	}

	public void setDataSourceID(String dataSourceID) {
		this.dataSourceID = dataSourceID;
	}

	public String getJdbcDriver() {
		return jdbcDriver;
	}

	public void setJdbcDriver(String jdbcDriver) {
		this.jdbcDriver = jdbcDriver;
	}

	public String getJdbcUrl() {
		return jdbcUrl;
	}

	public void setJdbcUrl(String jdbcUrl) {
		this.jdbcUrl = jdbcUrl;
	}

	public String getJdbcUser() {
		return jdbcUser;
	}

	public void setJdbcUser(String jdbcUser) {
		this.jdbcUser = jdbcUser;
	}

	public String getJdbcPassword() {
		return JdbcPassword;
	}

	public void setJdbcPassword(String jdbcPassword) {
		JdbcPassword = jdbcPassword;
	}

	public String getBz() {
		return bz;
	}

	public void setBz(String bz) {
		this.bz = bz;
	}
public static void main(String args[]){
	Tdatabase t=new Tdatabase("", "", "", "", "","charset=utf-8,poolsize=10");
}
}
